package fun.sssdnsy.media.image;

import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import java.io.*;

public class EmbeddedLinkedImage implements LinkedImage {
    private final byte[] imageData;

    public EmbeddedLinkedImage(byte[] imageData) {
        this.imageData = imageData;
    }

    @Override
    public boolean isReal() {
        return false; // 非 RealLinkedImage
    }

    @Override
    public byte[] getImageData() {
        return imageData;
    }

    @Override
    public Node createNode() {
        return new ImageView(new Image(new ByteArrayInputStream(imageData)));
    }

    @Override
    public String toString() {
        return "EmbeddedLinkedImage[" + imageData.length + " bytes]";
    }
}
